<!DOCTYPE html>
<html>
<head>
		<title>用户主页面</title>
	<meta charset="UTF-8">
	<style >
	 #In-table{
	 	border: 1;
		width:500px;
		height:50px;
		margin-top:20px;
	 }
	 blockquote{
	 	font-size:15px;
	 }
	 #check{
	 	position:fixed;
	 	width:500px;
	 	height:450px;
	 	background:#DDDDDD;
	 	top:150px;
	 	left:400px;
	 	z-index:100;
	 	
	 }
	 .check-title-pic{
	 	width:100px;
	 	margin-left:470px;
	 }
	 .check-title{
		width:100%;
		height:30px;
		background:#AAAAAA;
	 }
	 
	 .check-body{
	 	width:85%;
	 	height:90%;
	 	background:#DDDDDD;
	 	margin-left:44px;
	 	margin-top:-11px;
	 }
	 #Content{
	 	position:relative;
	 }
	 
	 #check ul{
	 	height:100%;
	 	width:250px;
	 	margin-left:130px;
	 	margin-top:25px;
	 }
	 #check li{
	 	list-style-type:none;
	 }
	 input{
	 	width:180px;
	 	height:20px;
	 	margin:5px 3px 5px 3px;
	 }
	 button{
	 	margin-top:10px;
	 	margin-left:50px;
	 	width:60px;
	 }
	</style>
	<script type="text/javascript" src="../jquery/jquery-1.11.3.js"></script>
	<link rel="stylesheet" href="../CSS/companyJob.css">
</head>
<body>
	<div id="Header">
		<div class="Header-Logo">
			<a href="http://www.baidu.com">
				<img src="../images/yy.png" alt="YY招聘网">
			</a>
		</div>
		<div class="Header-Logo-Right">
			<ul>
				<li>
					<a href="../system/userResume.html">我的档案</a>
				</li><li>
					<a id="getCompany" href="./CompanyInfo.html" target="_blank">公司</a>
				</li>
			</ul>
		</div>
	</div>
	<div id="Content">
		<div class="Content-Background"></div>
		<div class="Content-Background-Content">
			
			<div id="Main-Div" >
		</div>
	</div>
	
	<script>
	    
	   
		var userName = localStorage.getItem("loginName2");
		alert(userName+"+userName");
		var resumeJson;	//返回是json类型
		var jsonSize;
		var request = new XMLHttpRequest();
		var type = "GET";
		var URL="../Resume/getResumuByName.action?userName="+userName;
		request.open(type,URL);
		
		request.onreadystatechange = function(){
			if(request.readyState===4 && request.status ===200){
				var mark = JSON.parse(request.responseText);
				resumeJson = mark.data;
				jsonSize = mark.num;
				makeDiv();
			}
		};
		request.send();
		
		function makeDiv(){
			//var mainDiv = document.getElementById("Main-Div");//DIV
			alert(jsonSize+"+AAA");
			for(var i=0;i<jsonSize;i++){
				var mainDiv=document.getElementById("Main-Div");
				var mCompanyName = resumeJson[i].companyName;
				var mJobName = resumeJson[i].jobName;
				var mJobState = resumeJson[i].resumeState;
				var mResumeId = resumeJson[i].resumeId;
				if(mJobState == ""){
					mJobState = "未评价";
				}
				alert(mJobState);
				
				var lDiv = document.createElement("div");
				var rDiv = document.createElement("div");
				var zDiv = document.createElement("div");
				
				lDiv.className = "leftDiv";
				rDiv.className = "rightDiv";
				zDiv.className = "zongDiv";
				
				var jobName = document.createElement("p");
				var jobNum = document.createElement("p");
				var jobHave = document.createElement("p");
				
				var pA=document.createElement("a");
				pA.className="AA";
				pA.innerHTML="删除简历";
				 pA.setAttribute("href","javascript:void(0)");
				pA.setAttribute("id",mResumeId);
				pA.onclick=function(){
					postJobId("Jid",this.id);
				} 
				
				jobName.innerHTML = "公司名称: "+mCompanyName;
				jobNum.innerHTML = "岗位名称: "+mJobName;
				jobHave.innerHTML = "评价: "+mJobState;
				
				
				lDiv.appendChild(jobName);
				lDiv.appendChild(jobNum);
				lDiv.appendChild(jobHave);
				rDiv.appendChild(pA);
				
				mainDiv.appendChild(zDiv);
				zDiv.appendChild(lDiv);
				zDiv.appendChild(rDiv);
				//mainDiv.appendChild(rDiv);
			}
		}
		
		function postJobId(name,value2){
			var make = {
				"resumeId" : value2	
			};
			alert(value2);
			var type = "POST";
			var URL = "../Resume/delResumeById.action";
			request.open(type,URL);
			
			request.onreadystatechange = function(){
				if(request.readyState===4 && request.status===200){
					var type = request.getResponseHeader("Content-Type");
    				if(type.indexOf("xml")!==-1 && request.responseXML){		//Document对象响应
    					alert("yesss");
    				}
    				else if(type === "application/json"){						//JSON响应	
    					alert("000000000");
    				}
    				else{														//字符串响应
    					var mark = request.responseText;
						if(mark != 0){									//字符串与数字进行比较，先将字符串转换成数字，然后使用转换后值进行比较
							alert("删除成功！");
							//document.getElementById("check").style.display = "none";
						}
    				}
				}
			};
			request.setRequestHeader("Content-Type","application/json");
			request.send(JSON.stringify(make));
		}
	</script>
</body>
</html>